package com.ibuonline.b2b.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.dimeng.common.util.StringUtil;

public class ChannelProdCategory implements Serializable {

	private static final long serialVersionUID = -23407752743458668L;

	//fields
	private java.lang.Integer id;
	private java.lang.Integer parentId;
	private java.lang.String channel;
	private java.lang.Integer catId;
	private java.lang.String keyword;
	private java.lang.String highlight;
	private java.lang.String type;
	private java.lang.String position;
	private java.lang.Integer displayOrder;
	private java.sql.Timestamp createTime;

	//default constructor
	public ChannelProdCategory() {
	}

	//getter
	public java.lang.Integer getId() {
		return id;
	}
	public java.lang.Integer getParentId() {
		return parentId;
	}
	public java.lang.String getChannel() {
		return channel;
	}
	public java.lang.Integer getCatId() {
		return catId;
	}
	public java.lang.String getKeyword() {
		return keyword;
	}
	public java.lang.String getHighlight() {
		return highlight;
	}
	public java.lang.String getType() {
		return type;
	}
	public java.lang.String getPosition() {
		return position;
	}
	public java.lang.Integer getDisplayOrder() {
		return displayOrder;
	}
	public java.sql.Timestamp getCreateTime() {
		return createTime;
	}

	//setter
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public void setParentId(java.lang.Integer parentId) {
		this.parentId = parentId;
	}
	public void setChannel(java.lang.String channel) {
		this.channel = channel;
	}
	public void setCatId(java.lang.Integer catId) {
		this.catId = catId;
	}
	public void setKeyword(java.lang.String keyword) {
		this.keyword = keyword;
	}
	public void setHighlight(java.lang.String highlight) {
		this.highlight = highlight;
	}
	public void setType(java.lang.String type) {
		this.type = type;
	}
	public void setPosition(java.lang.String position) {
		this.position = position;
	}
	public void setDisplayOrder(java.lang.Integer displayOrder) {
		this.displayOrder = displayOrder;
	}
	public void setCreateTime(java.sql.Timestamp createTime) {
		this.createTime = createTime;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof ChannelProdCategory))
			return false;

		final ChannelProdCategory channelProdCategory = (ChannelProdCategory)other;
		if (!this.id.equals(channelProdCategory.getId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(id).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("ChannelProdCategory[")
			.append("id=").append(id).append(", ")
			.append("parentId=").append(parentId).append(", ")
			.append("channel=").append(channel).append(", ")
			.append("catId=").append(catId).append(", ")
			.append("keyword=").append(keyword).append(", ")
			.append("highlight=").append(highlight).append(", ")
			.append("type=").append(type).append(", ")
			.append("position=").append(position).append(", ")
			.append("displayOrder=").append(displayOrder).append(", ")
			.append("createTime=").append(createTime).append("]").toString();
	}
	///###
	public String getEncodeKeyword(){
		if (StringUtil.notEmpty(keyword)) {
			try {
				return URLEncoder.encode(keyword,"GBK");
			} catch (UnsupportedEncodingException e) {}
		}
		return null;
	}
}